package org.example.bean;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class Production {
        public String left;
        public Set<List<String>> right;

        public List<String> first;

        public List<String> follow;

    public List<String> VTSet;
    public Set<String> VNSet;


    public List<String> getVTSet() {
        return VTSet;
    }

    public void setVTSet(List<String> VTSet) {
        this.VTSet = VTSet;
    }

    public Set<String> getVNSet() {
        return VNSet;
    }

    public void setVNSet(Set<String> VNSet) {
        this.VNSet = VNSet;
    }
    public void initVN(){
//        for (List<String> strings : this.right) {
//            if(VN.isVN(strings.get(0))){
//                this.VNSet.add()
//            }
//        }
    }

    public Production(String left, Set<List<String>> right) {
            this.left = left;
            this.right = right;
        }
        public Production(){
            super();
        };

    public void setLeft(String left) {
        this.left = left;
    }

    public void setRight(Set<List<String>> right) {
        this.right = right;
    }

    public String getLeft() {
            return left;
        }

        public Set<List<String>> getRight() {
            return right;
        }

        @Override
        public String toString() {
            StringBuilder result = new StringBuilder();
            result.append(left).append(" -> ");
            int count = 0;
            for (List<String> strings : right) {
                if (count > 0) {
                    result.append("|");
                }
                for (String string : strings) {
                    result.append(string);
                }
                count++;
            }
            return result.toString();
        }

        //消除左递归


}
